package com.codezj;

import lombok.extern.slf4j.Slf4j;

import java.lang.instrument.Instrumentation;
import java.util.Arrays;

/**
 * @Author: baozhongjie
 * @Version: v1.0.0
 * @Description: Agent入口
 **/
@Slf4j
public class Agent {
    public static void premain(String args, Instrumentation inst) {
        // 由JVM调用
        log.info("========= Java Agent start ========= \n args: {}", args);
        inst.addTransformer(new MethodTransformer());
    }

    public static void main(String[] args) {
        System.out.println("This is a Java Agent");
        System.out.println("Usage: java -javaagent:this_agent.jar -jar your_application.jar");
    }

}
